Repository navigation
Complete PEP 798 operands and Python 3.15 diagnostics - #7
Draft
youknowdot wants to merge 5 commits into
Draft
youknowdot wants to merge 5 commits into
youknowdot wants to merge 5 commits into
Conversation
Parse full expression operands in dictionary and starred generator comprehensions. Preserve conditional-unpacking fallback ordering and recover malformed dictionary unpacking without invalid AST ranges. Add parser fixtures and regenerated snapshots. Assisted-by: OpenAI Codex:model version unavailable
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update parameter terminology and repeated-star wording without changing parameter parsing or recovered syntax. Regenerate affected snapshots. Assisted-by: OpenAI Codex:model-version-unavailable
Diagnose standalone case clauses, assertion assignments, mapping rest ordering and misplaced lazy imports. Preserve ordinary recovered ASTs and restore speculative recovery state, including lexical-error paths. Assisted-by: OpenAI Codex:model-version-unavailable
Project multiline literal-concatenation diagnostics onto the final literal line while retaining original expression ranges for lexical error precedence. Assisted-by: OpenAI Codex:model-version-unavailable
Report the opening brace line for multiline f-string and t-string replacement fields. Track lexical hint boundaries without changing recovered syntax or existing PEP 798 deferred-error state. Assisted-by: OpenAI Codex:model-version-unavailable
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete PEP 798 unpacking operands and selected Python 3.15 parser diagnostics on the RustPython 0.17.1 parser branch.
The original operand changes accept full expressions in dictionary comprehensions and starred generator expressions, preserving deferred-error ordering and valid recovered AST ranges. The appended diagnostics cover:
caseclauses, assertion assignment/walrus syntax, mapping-rest ordering, and misplacedlazyimports.Diagnostic speculation restores parser recovery state. Existing raise/from and trailing-with diagnostics retain their messages and ranges while gaining structured variants for standalone-case inner-error selection. No new Cargo feature or diagnostic version gate is introduced.
The oracle is CPython 3.15.0 at
d220409a13b77de7a6c30abe16ea90db01528edc, including its grammar, replacement-field tests, and syntax tests. This builds onrustpython-0.17.1; older-version work in #6 remains separate. RustPython consumers still need the resulting revision and separate compiler/VM integration; this is not a crates.io release.Validation of the appended diagnostics
Baseline: existing PR head
e72c1058999264cad17a01119a6fa57b3946a493.case()/match()calls. Their 51 compile calls were recorded without executing payloads and included in the finite native-parser comparison.--no-deps. Dependency-wide strict Clippy failed on the same nineunexpected_cfgserrors forcache/salsain both the exact baseline and candidate; the AST dependency is unchanged.parser::tests::cells_module_range_spans_sourceunit passed: one executed, 253 filtered. No other parser unit or workspace runtime suite was rerun.Five comparison cases retain pre-existing classification/priority differences: unclosed assertion RHS; an assertion RHS with an invalid f-string escape; a slash-only parameter list without a comma; an unclosed misplaced-lazy import list; and a misplaced-lazy alias containing an invalid f-string escape. Four complete error lists are unchanged. The slash-only list retains the pre-existing overbroad error classification with updated parameter wording. This change does not claim complete diagnostic parity.
Earlier PEP 798 validation
Before the appended diagnostics, the existing head passed 254 unit tests, 617 fixture tests, one integration test, and ten doctests; parser-only strict Clippy; and normal commit hooks. Its separate RustPython integration passed canonical
test_unpack_ex, 41 compile/error-order observations, eight bytecode/position observations, 482 related tests with 18 existing skips, and 31 selected async-generator tests. Those are historical results for the original operand change, not newly rerun proof for this append. The RustPython integration includes compiler changes outside this parser PR.Assistance
Prepared and tested with OpenAI Codex at the maintainer's explicit request for the RustPython-managed fork. No claim of manual maintainer review is implied.